﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WCrawlerLib;

namespace WCrawler
{
    public partial class frmForumIcon : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Panel pnlCommand = (Panel)ucForumControl.FindControl("pnlCommand");
                pnlCommand.Visible = false;
                GridView gridViewForums = (GridView)ucForumControl.FindControl("gridViewForums");
                gridViewForums.SelectedIndex = 0;
                CommandField cmdField = (CommandField)gridViewForums.Columns[0];
                cmdField.ShowEditButton = false;
                cmdField.ShowDeleteButton = false;
            }
        }

        public void ucForumControlSelectedIndexChanged(object sender, EventArgs e)
        {
            gridViewForumHostIcon.DataBind();
        }

        protected void ForumHostIconLinqDataSource_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        {
            ForumHost objForumHostIcon = new ForumHost();
            e.Result = objForumHostIcon.GetForumHostIconByForum(ucForumControl.SelectedValue);
        }

        protected void btnAddIcon_Click(object sender, EventArgs e)
        {
            ForumHost objForumHostIcon = new ForumHost();
            objForumHostIcon.AddForumHostIcon(ucForumControl.SelectedValue, int.Parse(dropDownListHost.SelectedValue), int.Parse(txtIconNumber.Text));
            gridViewForumHostIcon.DataBind();
        }
    }
}